#!/bin/sh

# ======= 路径配置 =========
IFS=$'\n' #避免文件名中有空格时出错,不然带空格的文件无法读取
# 当前配置文件的位置
profilesDir=$(pwd)/certificates

# 获取同级目录下的子文件，并执行方法(参数:$profilesDir)
function zm_openNewCertificates() {
for element in `ls $1`
    do
        dir_or_file=$1"/"$element
        if [ -d $dir_or_file ]
        then
            zm_openNewCertificates $dir_or_file
        else
            open $dir_or_file
        fi
    done
}

# 打印日志
function certificateLog() {
    echo "\n"
    echo "*  ========================== *"
    echo "*  证书名称        密码"
    echo "*  开发证书.p12      1"
    echo "*  ========================== *"
    echo "\n"
}

# 执行配置文件，带删除就数据
function zm_openCertificatesWithLog() {
    zm_openNewCertificates $profilesDir
    certificateLog
}

# ====== 方法执行 =======
zm_openCertificatesWithLog

